﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="reportSales.aspx.cs" Inherits="PeisongWeb.admin.reportSales" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Register TagName="top" Src="controls/top.ascx" TagPrefix="uc1" %>
<%@ Register TagName="menu" Src="controls/menu.ascx" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>销售报表 - 想购网长期采购物流配送系统</title>
    <!--#include file="style.inc"-->

    <script type="text/javascript">
        function resetSrh() {
            document.getElementById("ext_StartInputDt").value = "";
            document.getElementById("ext_EndInputDt").value = "";
            document.getElementById("drp_CategoryRoot").value = "";
            document.getElementById("drp_CategorySub").value = "";
            document.getElementById("drp_Company").value = "0";
        }

        function resetSrh2() {
            document.getElementById("txt_orderNo").value = "";
            document.getElementById("txt_startOrderDt").value = "";
            document.getElementById("txt_endOrderDt").value = "";
        }
        function exportValidate() {
            
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="sm1" runat="server">
    </asp:ScriptManager>
    <ext:ScriptManager ID="ScriptManager1" runat="server" />
    <uc1:top ID="Top1" runat="server" />
    <uc2:menu ID="Menu1" runat="server" />
    <div id="admin-body">
        <h2 class="section-cms">
            销售报表
        </h2>
        <ext:TabPanel runat="server" ActiveTabIndex="0">
            <Tabs>
                <ext:Tab Title="商品销售统计" AutoHeight="true" ID="ctl53" TabIndex="0">
                    <Body>
                        <asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Conditional">
                            <Triggers>
                                <asp:PostBackTrigger ControlID="link_Export_Detail" />
                            </Triggers>
                            <ContentTemplate>
                                <ext:Panel ID="Panel1" runat="server" Title="搜索" BodyStyle="padding:5px 5px 0" Width="1200px"
                                    Frame="true" ButtonAlign="Center">
                                    <Body>
                                        <div id="admin_edit_content_search">
                                            <ul>
                                                <li style="width: auto; margin-right: 5px">
                                                    <label style="width: 25px;">
                                                        大类
                                                    </label>
                                                    <asp:DropDownList runat="server" ID="drp_CategoryRoot" DataTextField="name" DataValueField="categoryId"
                                                        AutoPostBack="True" OnSelectedIndexChanged="ddl_CategoryRoot_SelectedIndexChanged">
                                                    </asp:DropDownList>
                                                </li>
                                                <li style="width: auto; margin-right: 5px">
                                                    <label style="width: 25px;">
                                                        小类
                                                    </label>
                                                    <asp:DropDownList runat="server" ID="drp_CategorySub" DataTextField="name" DataValueField="categoryId">
                                                    </asp:DropDownList>
                                                </li>
                                                <li style="width: 160px; margin-right: 5px;">
                                                    <label>
                                                        订单日期</label>
                                                    <ext:DateField ID="ext_StartInputDt" runat="server" AllowBlank="true" ReadOnly="true"
                                                        Width="100" />
                                                </li>
                                                <li style="width: 160px; margin-right: 5px">
                                                    <label style="width: 25px">
                                                        至</label>
                                                    <ext:DateField ID="ext_EndInputDt" ReadOnly="true" runat="server" Width="100" />
                                                </li>
                                                <li style="width: auto; margin-right: 5px">
                                                    <label>
                                                        采购企业
                                                    </label>
                                                    <asp:DropDownList runat="server" ID="drp_Company" Width="275px" DataTextField="company"
                                                        DataValueField="companyId">
                                                    </asp:DropDownList>
                                                </li>
                                                <li style="width: auto">[<asp:LinkButton ID="lbtn_Search" runat="server" Text="分 析"
                                                    OnClick="lbtn_Search_Click"></asp:LinkButton>]&nbsp;&nbsp;&nbsp; [<a href="javascript:resetSrh();">重
                                                        置</a>]<input type="hidden" runat="server" id="hid_categoryId" />&nbsp;&nbsp&nbsp;
                                                    <span style="<%=power>=2?"": "display:none" %>">[<asp:LinkButton runat="server" ID="link_Export_Detail"
                                                        OnClientClick="return exportValidate();" Text="导出详细信息" OnClick="link_Export_Detail_Click" />]
                                                    </span></li>
                                            </ul>
                                        </div>
                                    </Body>
                                </ext:Panel>
                                <p>
                                    &nbsp;</p>
                                <div id="admin_list_content" style="width: 1200px">
                                    <table cellpadding="0" cellspacing="0">
                                        <tr class="header-row">
                                            <th>
                                                商品大类
                                            </th>
                                            <th>
                                                商品小类
                                            </th>
                                            <th>
                                                采购商
                                            </th>
                                            <th>
                                                平均单价
                                            </th>
                                            <th>
                                                平均数量
                                            </th>
                                            <th>
                                                总数量
                                            </th>
                                            <th>
                                                总计
                                            </th>
                                            <th>
                                                详细信息
                                            </th>
                                        </tr>
                                        <asp:Repeater ID="rpt_list" runat="server" OnItemCommand="rpt_list_ItemCommand">
                                            <ItemTemplate>
                                                <tr class='<%# Container.ItemIndex%2==0? "row-alt":"alt"  %>'>
                                                    <td>
                                                        <%#Eval("parentName")%>
                                                    </td>
                                                    <td>
                                                        <%# Eval("subCategory")%>
                                                    </td>
                                                    <td>
                                                        <%#Eval("stockNum")%>家
                                                    </td>
                                                    <td>
                                                        <%#String.Format("{0:F2}", Eval("avgPrice"))%>
                                                    </td>
                                                    <td>
                                                        <%#String.Format("{0:F2}", Eval("avgQuantity"))%>
                                                    </td>
                                                    <td>
                                                        <%#Eval("sumQuantity")%>
                                                    </td>
                                                    <td>
                                                        <%# String.Format("{0:F2}", Eval("sumAmount")).ToString()%>
                                                    </td>
                                                    <td>
                                                        <asp:LinkButton ID="lbn_details" runat="server" CommandName="details" CommandArgument='<%# Eval("categoryid") %>'
                                                            Text="查看详情">
                                                        </asp:LinkButton>
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </table>
                                </div>
                                <ext:Window ID="category_details" runat="server" Title="商品分类详情" Height="620px" Width="920px"
                                    BodyStyle="padding: 6px; background-color: #fff;" AutoScroll="true" Modal="True"
                                    Resizable="false" ShowOnLoad="false" Draggable="false" Icon="ApplicationViewDetail">
                                    <Body>
                                        <asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
                                            <ContentTemplate>
                                                <div class="details">
                                                    <table width="98%" border="0" cellpadding="4" cellspacing="1" style="text-align: left">
                                                        <tr>
                                                            <td style="width: 6%">
                                                                订单号：
                                                            </td>
                                                            <td style="width: 20%">
                                                                <asp:TextBox ID="txt_orderNo" runat="server" Width="80px"></asp:TextBox>
                                                            </td>
                                                            <td style="width: 8%">
                                                                订单日期：
                                                            </td>
                                                            <td style="width: 12%">
                                                                <ext:DateField ID="txt_startOrderDt" runat="server" AllowBlank="true" ReadOnly="true"
                                                                    Width="100" />
                                                            </td>
                                                            <td style="width: 3%">
                                                                至
                                                            </td>
                                                            <td style="width: 20%">
                                                                <ext:DateField ID="txt_endOrderDt" ReadOnly="true" runat="server" Width="100" />
                                                            </td>
                                                            <td style="width: 7%">
                                                                <asp:LinkButton ID="lbn_search" runat="server" Text="［搜索］" CausesValidation="false"
                                                                    OnClick="lbn_search_Click">
                                                                </asp:LinkButton>
                                                            </td>
                                                            <td style="width: 22%">
                                                                <a href="javascript:resetSrh2();">［重置］</a>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <p>
                                                        &nbsp;</p>
                                                    <table width="98%" border="0" cellpadding="4" cellspacing="1" bgcolor="#99BBE8" style="text-align: left">
                                                        <tr align="center" style="height: 20px;">
                                                            <td width="8%" bgcolor="#C0D5F0">
                                                                商品编号
                                                            </td>
                                                            <td width="10%" bgcolor="#C0D5F0">
                                                                商品名称
                                                            </td>
                                                            <td width="8%" bgcolor="#C0D5F0">
                                                                规格
                                                            </td>
                                                            <td width="10%" bgcolor="#C0D5F0">
                                                                供应商价格
                                                            </td>
                                                            <td width="10%" bgcolor="#C0D5F0">
                                                                数量
                                                            </td>
                                                            <td width="10%" bgcolor="#C0D5F0">
                                                                单价
                                                            </td>
                                                            <td width="10%" bgcolor="#C0D5F0">
                                                                小计
                                                            </td>
                                                            <td width="10%" bgcolor="#C0D5F0">
                                                                订单号
                                                            </td>
                                                        </tr>
                                                        <asp:Repeater runat="server" ID="rpt_Products">
                                                            <ItemTemplate>
                                                                <tr align="center" style="height: 20px;">
                                                                    <td bgcolor="#FFFFFF">
                                                                        <%#Eval("productNo")%>
                                                                    </td>
                                                                    <td bgcolor="#FFFFFF">
                                                                        <%#Eval("proName")%>
                                                                    </td>
                                                                    <td bgcolor="#FFFFFF">
                                                                        <%#Eval("standard")%>
                                                                    </td>
                                                                    <td bgcolor="#FFFFFF">
                                                                        <%#String.Format("{0:F2}",Eval("sellerPrice"))%>/<%#Eval("unit")%>
                                                                    </td>
                                                                    <td bgcolor="#FFFFFF">
                                                                        <%#Eval("quantity")%>
                                                                    </td>
                                                                    <td bgcolor="#FFFFFF" align="center">
                                                                        <%#String.Format("{0:F2}",Eval("price"))%>/<%#Eval("unit")%>
                                                                    </td>
                                                                    <td bgcolor="#FFFFFF" align="center">
                                                                        <%#String.Format("{0:F2}",Eval("amount"))%>
                                                                    </td>
                                                                    <td bgcolor="#FFFFFF" align="center">
                                                                        <%#Eval("orderNo")%>
                                                                    </td>
                                                                </tr>
                                                            </ItemTemplate>
                                                        </asp:Repeater>
                                                    </table>
                                                    <div>
                                                        <webdiyer:AspNetPager ID="AspNetPager2" NumericButtonType="Text" MoreButtonType="Text"
                                                            runat="server" AlwaysShow="False" PageSize="20" InvalidPageIndexErrorMessage="无效页码"
                                                            PageIndexOutOfRangeErrorMessage="页码超出范围" ShowCustomInfoSection="Left" CustomInfoHTML=" 每页%PageSize%条记录 | 总共%RecordCount%条记录 "
                                                            CustomInfoTextAlign="Left" HorizontalAlign="Right" OnPageChanged="AspNetPager2_PageChanged"
                                                            NextPageText="下一页" FirstPageText="首页" LastPageText="末页" PrevPageText="上一页">
                                                        </webdiyer:AspNetPager>
                                                    </div>
                                                </div>
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </Body>
                                </ext:Window>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </Body>
                </ext:Tab>
                <ext:Tab ID="ctl39" runat="server" IDMode="Legacy" Title="销售排行分析" TabIndex="1" AutoHeight="true">
                    <Body>
                        <asp:UpdatePanel runat="server" ID="UpdatePanel3" UpdateMode="Conditional">
                            <Triggers>
                                <asp:PostBackTrigger ControlID="link_Export_ProductSale" />
                            </Triggers>
                            <ContentTemplate>
                                <ext:Panel ID="Panel2" runat="server" Title="搜索" BodyStyle="padding:5px 5px 0" Width="1200px"
                                    Frame="true" ButtonAlign="Center">
                                    <Body>
                                        <div id="admin_edit_content_search">
                                            <ul>
                                                <li style="width: auto; margin-right: 5px">
                                                    <label style="width: 25px;">
                                                        大类
                                                    </label>
                                                    <asp:DropDownList runat="server" ID="ddlCategoryRoot" DataTextField="name" DataValueField="categoryId"
                                                        AutoPostBack="True" OnSelectedIndexChanged="ddlCategoryRoot_SelectedIndexChanged">
                                                    </asp:DropDownList>
                                                </li>
                                                <li style="width: auto; margin-right: 5px">
                                                    <label style="width: 25px;">
                                                        小类
                                                    </label>
                                                    <asp:DropDownList runat="server" ID="ddlCategorySub" DataTextField="name" DataValueField="categoryId">
                                                    </asp:DropDownList>
                                                </li>
                                                <li style="width: 160px; margin-right: 5px;">
                                                    <label>
                                                        订单日期</label>
                                                    <ext:DateField ID="txtStartOrderDt" runat="server" AllowBlank="true" ReadOnly="true"
                                                        Width="100" />
                                                </li>
                                                <li style="width: 160px; margin-right: 20px">
                                                    <label style="width: 25px">
                                                        至
                                                    </label>
                                                    <ext:DateField ID="txtEndOrderDt" ReadOnly="true" runat="server" Width="100" />
                                                </li>
                                                <li style="width: auto; margin-right: 5px;">
                                                    <label>
                                                        查询条件</label>
                                                    <asp:DropDownList runat="server" ID="ddlFields">
                                                        <asp:ListItem Value="totalQuantity">订购量</asp:ListItem>
                                                        <asp:ListItem Value="totalCount">订购次数</asp:ListItem>
                                                        <asp:ListItem Value="totalSale">销售总额</asp:ListItem>
                                                    </asp:DropDownList>
                                                </li>
                                                <li style="width: auto; margin-right: 5px;">
                                                    <label>
                                                        排名前</label>
                                                    <asp:TextBox runat="server" ID="txtTopNum" Width="35px" Text="50"></asp:TextBox>
                                                </li>
                                                <li style="width: auto;">
                                                    <asp:LinkButton runat="server" ID="lin_Stat_Auto" OnClick="lin_Stat_Auto_Click">[统 计]</asp:LinkButton>
                                                    &nbsp;&nbsp;
                                                      <span style="<%=power>=2?"": "display:none" %>">
                                                    <asp:LinkButton runat="server" ID="link_Export_ProductSale" OnClick="link_Export_ProductSale_Click">[导 出]</asp:LinkButton>
                                                    </span>
                                                </li>
                                            </ul>
                                        </div>
                                    </Body>
                                </ext:Panel>
                                <p>
                                    &nbsp;</p>
                                <div id="admin_list_content" style="width: 1200px">
                                    <table cellpadding="0" cellspacing="0">
                                        <table cellpadding="0" cellspacing="0">
                                            <tr class="header-row">
                                                <th>
                                                    商品名称
                                                </th>
                                                <th>
                                                    订购量
                                                </th>
                                                <th>
                                                    订购次数
                                                </th>
                                                <th>
                                                    销售总额
                                                </th>
                                            </tr>
                                            <asp:Repeater ID="rptStat" runat="server">
                                                <ItemTemplate>
                                                    <tr class='<%# Container.ItemIndex%2==0? "row-alt":"alt"  %>'>
                                                        <td>
                                                            <%#DataBinder.Eval(Container.DataItem,"proName")%>
                                                        </td>
                                                        <td>
                                                            <%#DataBinder.Eval(Container.DataItem,"totalQuantity","{0:F2}")%>
                                                        </td>
                                                        <td>
                                                            <%#DataBinder.Eval(Container.DataItem,"totalCount")%>
                                                        </td>
                                                        <td>
                                                            <%#DataBinder.Eval(Container.DataItem,"totalSale","{0:F2}")%>
                                                        </td>
                                                    </tr>
                                                </ItemTemplate>
                                            </asp:Repeater>
                                        </table>
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </Body>
                </ext:Tab>
            </Tabs>
        </ext:TabPanel>
    </div>
    </form>
</body>
</html>
